package com.itheima.udp3;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class ClientDemo {

    public static void main(String[] args) throws Exception {
        //创建发送对象
        DatagramSocket ds = new DatagramSocket();
        //组织数据
        byte[] bytes = "来啊,大战500回合啊".getBytes();
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length, InetAddress.getByName("255.255.255.255"), 8888);
        // 发送
        ds.send(dp);
        //释放资源
        ds.close();
    }
}
